home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4711 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
  2. From: Dan Pop <danpop@mail.cern.ch>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Unbuffered character input...
  5. Date: Tue, 6 Feb 1996 18:01:46 +0100
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <9602061701.AA21789@dxmint.cern.ch>
  8. References: <Pine.SGI.3.91.960129190205.27936A-100000@tahiti.cs.unm.edu> <4elf0t$5vd@ixnews2.ix.netcom.com> <4ep3a1$bee@hacgate2.hac.com> <DM2zCI.379@emr1.emr.ca> <9602011208.AA06949@dxmint.cern.ch> <4etiup$fig@airdmhor.gen.nz> <9602022043.AA13287@dxmint.cern.ch> <4f7hlf$87n@airdmhor.gen.nz>
  9. X-NNTP-Posting-Host: hpl3sn03.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11. X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
  12.  
  13. gumboot@airdmhor.gen.nz (Simon Hosie) writes:
  14.  
  15. >gumboot@airdmhor.gen.nz (Simon Hosie) writes:
  16. >> What is the advantage of line buffering user input, anyway?
  17. >
  18. >Dan Pop:
  19. >> 1. It optimizes the cpu time spent on terminal I/O.  Not an issue on a
  20. >>    DOS box, but quite important on systems with hundreds of terminals.
  21. >
  22. >  Line buffering tends to be a function of the terminal rather than the
  23. >(significant) processor, then?
  24.  
  25. One some systems, it is a function of the terminal, indeed.
  26.  
  27. But even on systems where it is not, it still saves processor time.
  28. The cpu overhead of making a single OS call to get a complete line of input
  29. is smaller (sometimes significantly smaller) than the overhead of making
  30. N OS calls, one for each character of the line.  The stdio library tries
  31. to do its best to minimize the number of (expensive) OS calls.
  32.  
  33. On MSDOS the OS calls are cheap, but on more sophisticated operating
  34. systems they (usually) aren't, because they involve a transition from
  35. user mode to kernel mode and back to user mode.
  36.  
  37. Dan
  38. -- 
  39. Dan Pop
  40. CERN, CN Division
  41. Email: danpop@mail.cern.ch 
  42. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  43.